home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #14 / Monster Media No. 14 (April 1996) (Monster Media, Inc.).ISO / pcboard / msgtag11.zip / MEC.PPS < prev    next >
Text File  |  1996-01-30  |  12KB  |  364 lines

  1. ; MEC.PPE by Dan Shore - SysOp
  2. ;            The Shoreline BBS
  3. ;
  4. ; Revised on  :  11/01/95
  5. ; Revised by  :  Dan Shore
  6. ; Purpose     :  To let user choose which set of 20 tagged messages to
  7. ;                read instead of *forcing* only the first 20.  Two new
  8. ;                subroutines added:  DISPLAY_MSG_SETS, GET_NEXT_VALUE
  9. ;
  10. ; Purpose: Message Command prompt replacement for use with the msg
  11. ;          tagging PPE's (QSCAN, READ, KILL, RECOVER, MORE, MEC)
  12. ;
  13. ; To install:
  14. ;
  15. ;    1) Edit your PCBText file and change the following entry:
  16. ;
  17. ;       MKPCBTXT PCBTEXT /I:425 "!C:\PCB\PPE\QSCAN\MEC.PPE"
  18. ;       MKPCBTXT PCBTEXT /I:584 "!C:\PCB\PPE\QSCAN\MEC.PPE"
  19. ;
  20. ;       Note: You may have to change the pathname to the PPE.
  21. ;
  22. ;───────────────────────────────────────────────────────────────────────────
  23. STRING sema_path         '  Path and semaphore file
  24. STRING main_prompt       '  Common input prompt
  25. STRING hold              '  Garbage variable
  26. STRING hold2             '  Garbage variable
  27. STRING page_length_file  '  Users original page length
  28. STRING tag_msg_file      '  Tagged msgs
  29. STRING start_msg_num     '  Starting msg number when reading a set
  30. STRING end_msg_num       '  Ending msg number when reading a set
  31.  
  32. BIGSTR user_input        '  Common user input - used with tagged msgs
  33. BIGSTR user_input_temp   '  Temp variable for parsing information
  34. BIGSTR temp              '  Garbage variable  - used with tagged msgs
  35.  
  36. INT    x                 '  Common INT variable
  37. INT    msg_num_count     '  Number of tagged messages
  38. INT    set_number        '  20 Msg number set
  39. ;───────────────────────────────────────────────────────────────────────────
  40.  
  41. :MAIN
  42.  
  43.   '
  44.   '  Get path to swap file directory
  45.   '
  46.   hold = READLINE(PCBDAT(),204)
  47.   hold = FILEINF(hold,6) + ":" + FILEINF(hold,7)
  48.  
  49.   '
  50.   '  Determine paths and names of files used by MEC.PPE
  51.   '
  52.   sema_path = hold + "msgtag.use"
  53.   tag_msg_file = hold + "mtg" + STRING(CURCONF()) + ".lst"
  54.   page_length_file = hold + "userpl.dat"
  55.  
  56.   '
  57.   '  See if the semaphore file exists and then the page length file.
  58.   '  If page length file exists, read it and restore users original setting
  59.   '
  60.   IF (EXIST(sema_path)) THEN
  61.     IF (EXIST(page_length_file)) THEN
  62.       GETUSER
  63.       FOPEN 7, page_length_file, O_RD, S_DN
  64.       FGET 7, hold
  65.       U_PAGELEN = TOINT(hold)
  66.       PUTUSER
  67.       FCLOSE 7
  68.       DELETE page_length_file
  69.     END IF
  70.   END IF
  71.  
  72.   hold = STRING(LOMSGNUM()) + "-" + STRING(HIMSGNUM())
  73.  
  74. '
  75. '  Display Message Command (tagged file list present) prompt and get response
  76. '
  77. :MEC_PROMPT
  78.   '
  79.   '  See if MTG?.LST file is larger than 0 bytes.  If so we have tagged msgs.
  80.   '
  81.   IF (FILEINF(tag_msg_file,4)> 0) THEN
  82.     main_prompt = "@X02[@X0FH@X02]elp,@X02(@X0F" + hold + "@X02),@X02(@X0FTAG/DELTAG@X02), @X0EEnter your message command"
  83.     INPUTSTR main_prompt, user_input, @X0E, 250, MASK_ASCII(), UPCASE+LFAFTER+STACKED
  84.     user_input = TRIM(user_input," ")
  85.     '
  86.     '  Exit the PPE
  87.     '
  88.     IF (user_input = "") THEN
  89.       KBDSTUFF CHR(13)
  90.       END
  91.     '
  92.     '  Read TAGGED MSGs
  93.     '
  94.     ELSE IF (user_input = "TAG") THEN
  95.       '
  96.       '  Read tagged messages from disk file MTG?.LST
  97.       '
  98.       GOSUB PROCESS_TAGGED
  99.       '
  100.       '  See how many tokens there are.  Remember that TOKCOUNT will only
  101.       '  report the number of tokens it finds up to the 256th character
  102.       '  in the string user_input.
  103.       '
  104.       '  It will be able to report more than 20 tokens even if the
  105.       '  message numbers are 9 characters long.
  106.       '
  107.       '  9 characters for msg number, 1 char for semi-colon = 10 chars
  108.       '  256 characters / 10 = 25.6 msg numbers
  109.       '
  110.       TOKENIZE user_input
  111.       msg_num_count = TOKCOUNT()
  112.       IF (msg_num_count > 20) THEN
  113.         '
  114.         '  Display to the user the SETS of 20 tagged messages
  115.         '
  116.         GOSUB DISPLAY_MSG_SETS
  117.         '
  118.         '  Prompt the user which SET of msgs they wish to read
  119.         '
  120.         hold = ""
  121.         main_prompt = "       @X0BChoose set number to read @X0E(Enter=quit)@X07"
  122.         INPUTSTR main_prompt, hold, @X0E, 2, MASK_NUM(), LFAFTER+GUIDE+FIELDLEN
  123.         IF (hold != "") THEN
  124.           '
  125.           '  temp is a string variable that contains the starting and ending
  126.           '  message numbers of each set.  We read this variable and once
  127.           '  we get the starting and ending numbers, we can get the whole
  128.           '  range of numbers (20) from the variable user_input.  user_input
  129.           '  contains ALL the tagged message numbers.
  130.           '
  131.           TOKENIZE temp
  132.           FOR x = 1 to set_number
  133.             '
  134.             '  Retrieve first set of staring and ending message numbers
  135.             '
  136.             hold2 = GETTOKEN()
  137.             '
  138.             '  See if the loop count matches the users input for set to read
  139.             '
  140.             IF (x = TOINT(hold)) THEN
  141.               '
  142.               '  Get starting and ending message number
  143.               '
  144.               start_msg_num = MID(hold2,1,INSTR(hold2,",")-1)
  145.               end_msg_num = MID(hold2,INSTR(hold2,",")+1, LEN(hold2)-INSTR(hold2,","))
  146.               '
  147.               '  Get set of 20 message numbers from user_input and put
  148.               '  range in user_input.  Break out of FOR loop so we can
  149.               '  stuff the keyboard user_input
  150.               '
  151.               user_input = MID(user_input, INSTR(user_input, start_msg_num), INSTR(user_input, end_msg_num) - INSTR(user_input, start_msg_num) + LEN(end_msg_num))
  152.               BREAK
  153.             END IF
  154.           NEXT
  155.         '
  156.         '  User hit CR to the Message command prompt
  157.         '
  158.         ELSE
  159.           user_input = ""
  160.         END IF
  161.       END IF
  162.       '
  163.       '  Stuff keyboard with user_input.  (message numbers to read or nothing)
  164.       '
  165.       KBDSTUFF CHR(13) + "R;" + user_input + CHR(13)
  166.       END
  167.     '
  168.     '  Delete Tagged Msgs
  169.     '
  170.     ELSE IF (user_input = "DELTAG") THEN
  171.       DELETE tag_msg_file
  172.       NEWLINE
  173.       PRINTLN "@X0AYour '@X0ETagged@X0A' Messsage Number list for this conference has been @X0Cdeleted.@X07"
  174.       NEWLINE
  175.       DELAY 36
  176.       KBDSTUFF CHR(13)
  177.       END
  178.     '
  179.     '  Process all other entries and pass to PCB to process
  180.     '
  181.     ELSE
  182.       KBDSTUFF user_input + CHR(13)
  183.       END
  184.     END IF
  185.   END IF
  186.  
  187.   '
  188.   '  Display Message Command (tagged file list NOT present) prompt and get response
  189.   '
  190.   main_prompt =  "(H)elp, (" + hold + "), Enter your Message Command"
  191.   INPUTSTR main_prompt, user_input, @X0E, 80, MASK_ASCII(), UPCASE+LFAFTER+STACKED
  192.   user_input = TRIM(user_input," ")
  193.   '
  194.   '  If user selected "Q", the QSCAN.PPE will run, so create the semaphore file
  195.   '
  196.   IF (LEFT(user_input,1) = "Q") THEN
  197.     FOPEN 1, sema_path, O_WR, S_DN
  198.     FCLOSE 1
  199.   END IF
  200.   KBDSTUFF user_input + CHR(13)
  201.  
  202.   END
  203.  
  204. '
  205. ' Read the tagged files (disk file) into user_input
  206. '
  207. :PROCESS_TAGGED
  208.  
  209.    FOPEN 1, tag_msg_file, O_RD, S_DN
  210.    FREAD 1, user_input, FILEINF(tag_msg_file,4)
  211.    FCLOSE 1
  212.    RETURN
  213.  
  214. '
  215. '
  216. '
  217. :DISPLAY_MSG_SETS
  218.  
  219.   '
  220.   '  Display information screen so user knows what is happening
  221.   '
  222.   PRINTLN
  223.   PRINTLN "@X0E┌──────────────────────────────────────────────────────────────┐"
  224.   PRINTLN "│@X0BDue to a limitation of PCBoard, only 20 Message numbers can be@X0E│"
  225.   PRINTLN "│@X0Bstacked to read at one time.  Pick the @X0DSET NUMBER@X0B of tagged   @X0E│"
  226.   PRINTLN "│@X0Bmessages you wish to read.                                    @X0E│"
  227.   PRINTLN "@X0E└──────────────────────────────────────────────────────────────┘"
  228.   PRINTLN
  229.  
  230.   '
  231.   '  Display our set number heading
  232.   '
  233.   PRINTLN "@X0FSet #  @X0CTagged Message Numbers@X07"
  234.   PRINTLN "@X0A─────  ────────────────────────────────────────────────────────"
  235.  
  236.   '
  237.   '  Start our set number at 1, and start the set number display of msg #'s
  238.   '
  239.   set_number = 1
  240.   PRINT SPACE(3-LEN(STRING(set_number))), "@X0F", set_number, SPACE(4)
  241.  
  242.   '
  243.   '  Initialize variables to starting values
  244.   '
  245.   '  x = the number of message numbers we have printed to the screen
  246.   '
  247.   '  temp is a string variable that contains the starting and ending
  248.   '  message numbers of each set and has the format of:
  249.   '
  250.   '         start,end;start,end;start,end;
  251.   '
  252.   x = 0
  253.   temp = ""
  254.  
  255.   '
  256.   '  Place user_input value into user_input_temp so we can parse it
  257.   '  and not destroy the contents of user_input which we will need once
  258.   '  the user decides which set to read.
  259.   '
  260.   user_input_temp = user_input
  261.  
  262.   '
  263.   '  Process our first number, print it to the screen, and add the
  264.   '  staring number for this set to temp variable.  Increment the
  265.   '  number of message numbers printed to screen (x)
  266.   '
  267.   GOSUB GET_NEXT_VALUE
  268.   PRINT "@X02", hold, " "
  269.   temp = hold + ","
  270.   INC x
  271.  
  272.   '
  273.   '  Process the remaining numbers
  274.   '
  275.   WHILE (1) DO
  276.     '
  277.     '  If we have reached our 20th message number, do this section
  278.     '
  279.     IF (x = 20) THEN
  280.       '
  281.       '  If 20th number, add ending number to temp variable,
  282.       '  and set the number of messages printed to the screen
  283.       '  to 0 in prepartion for displaying next set.
  284.       '
  285.       temp = temp + hold + ";"
  286.       x = 0
  287.       PRINTLN
  288.       PRINTLN
  289.       '
  290.       '  Get our next message number
  291.       '
  292.       GOSUB GET_NEXT_VALUE
  293.       '
  294.       '  If no more message numbers (hold = ""), then break out of WHILE loop
  295.       '
  296.       IF (hold = "") THEN
  297.         temp = temp + hold2 + ";"
  298.         BREAK
  299.       END IF
  300.       '
  301.       '  Print next set number since we have more message numbers to process
  302.       '
  303.       INC set_number
  304.       PRINT SPACE(3-LEN(STRING(set_number))), "@X0F",set_number, SPACE(4)
  305.  
  306.       '
  307.       '  Process our first number of the next set, print it to the screen, and
  308.       '  add the starting number for this set to temp variable.  Increment the
  309.       '  number of message numbers printed to screen (x), and increment the
  310.       '  set number
  311.       '
  312.       PRINT "@X02", hold, " "
  313.       temp = temp + hold + ","
  314.       INC x
  315.       '
  316.       '  Go back to the WHILE statement as we have processed our 20th msg
  317.       '  number and we do not want to process command below this
  318.       '
  319.       CONTINUE
  320.     '
  321.     '  If we have reached our 10th message number, go to the next line
  322.     '  on the screen and print 7 spaces for lining up of message numbers
  323.     '  in two rows of ten numbers each
  324.     '
  325.     ELSE IF (x = 10) THEN
  326.       PRINTLN
  327.       PRINT SPACE(7)
  328.     END IF
  329.  
  330.     '
  331.     '  Process the next number and display it on the screen
  332.     '
  333.     GOSUB GET_NEXT_VALUE
  334.     '
  335.     '  If no more message numbers (hold = ""), then break out of WHILE loop
  336.     '
  337.     IF (hold = "") THEN
  338.       temp = temp + hold2 + ";"
  339.       NEWLINES 2
  340.       BREAK
  341.     END IF
  342.     '
  343.     '  Print the message number to the screen
  344.     '
  345.     PRINT "@X02", hold, " "
  346.     INC x
  347.     hold2 = hold
  348.  
  349.   END WHILE
  350.   RETURN
  351.  
  352. '
  353. '  This routine was written due to GETOKEN not being able to parse past
  354. '  the 256th character of a string.  Reported to CDC on 11/1/95
  355. '
  356. '  hold is the variable that contains the next value
  357. '  parsed from the user_input_temp variable
  358. '
  359. :GET_NEXT_VALUE
  360.  
  361.   hold = MID(user_input_temp, 1, INSTR(user_input_temp, ";")-1)
  362.   user_input_temp = MID(user_input_temp, INSTR(user_input_temp, ";")+1, LEN(user_input_temp)-INSTR(user_input_temp,";"))
  363.   RETURN
  364.